<?php
	if($dt[0]['trangthai_tinbai']==1||$dt[0]['trangthai_tinbai']==2) $up = 1;
	else $up = 0;
	if($this->session->userdata('level')>1 && $up==1) $disabled = "";
	else $disabled = "disabled";
?>
<div class="box grid_6 round_all tabs">
	<ul class="tab_header grad_colour clearfix">
		<li>
			<a href="#tabs-nhanxet">Nhận xét</a>
		</li>
		<li>
			<a href="#tabs-lichsu">Lịch sử</a>
		</li>
		<li>
			<a href="#tabs-thongtin" class="round_top">Thông tin</a>
		</li>
	</ul>
	<a href="#" class="grabber">&nbsp;</a>
	<a href="#" class="toggle">&nbsp;</a>
	<div class="toggle_container">
		<div id="tabs-nhanxet" class="block">
		<form id="form">
			<table>							
				<td><button class="button_colour round_all" <?php echo $disabled; ?> onclick = "submitForm1('baoDuyet','Bạn có muốn duyệt tin bài lên?')" ><?php echo img(array( 'src' => 'images/icons/small/white/Bended%20Arrow%20Right.png', 'height' => '24') )?><span>Duyệt lên</span></button></td>
		</form>
				<td><button type="button" class="button_colour round_all" onclick = "baoSua()"><?php echo img(array('src' => 'images/icons/small/white/Bended%20Arrow%20Right.png', 'height' => '24') )?><span>Báo sửa</span></button></td>
			</table>
		<textarea id="notenews" name="notenews" ><?php echo set_value('notenews')?></textarea>		
		</div>
		<div id="tabs-lichsu" class="block">
			<div class="content">
				<h1>Lịch sử bài viết</h1>
				<p>Số lần sửa: </p>
				<p>Người sửa cuối: </p>
				<p>Ngày sửa cuối: </p> 
			</div>
		</div>
		<div id="tabs-thongtin" class="block">
			<div class="content">
				<h1>Thông tin bài viết</h1>
				<p>Số lượt view:</p>
				<p>Số lượt comment:</p>
				<p>Ngày tạo:</p>
				<p>Người tạo:</p> 
			</div>
		</div>
	</div>
</div>
<script>
function submitForm1(buttonID, message){
	var form;
    form=document.getElementById('form');
    if(buttonID=='baoDuyet') 
    {
        if(confirm(message))
         form.action= "<?php echo base_url() ?>news/takeUpNews/<?php echo $dt[0]['id_tinbai']?>/<?php echo $dt[0]['trangthai_tinbai']?>";  		                  
         //alert(form.action);
    }
}
var notenews = new LiveValidation('notenews');
notenews.add( Validate.Presence );
notenews.add( Validate.Length, { minimum: 5 } );
function baoSua(){	
   	var ajax = new XMLHttpRequest();
  	var str = "&id_article="+<?php echo $dt[0]['id_tinbai']?>;
  	ajax.open("POST","<?php echo base_url(); ?>news/takeEditNews",true);
  	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
  	ajax.send(str);
   	ajax.onreadystatechange = function(){
		if(ajax.readyState == 4)
		{
         	alert(ajax.responseText);
 		}
	} 
}
</script>